package com.uzai.console.web.wxqcontactrefresh;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.annotation.SystemLogType;
import com.uzai.console.dto.wxqcontactrefresh.WxqContactRefreshIdDto;
import com.uzai.console.dto.wxqcontactrefresh.WxqContactRefreshIdListDto;
import com.uzai.console.dto.wxqcontactrefresh.WxqContactRefreshQuery;
import com.uzai.console.enums.OperationTypeEnum;
import com.uzai.console.enums.SystemModelEnum;
import com.uzai.console.service.wxqcontactrefresh.WxqContactRefreshService;
import com.uzai.console.vo.wxqcontactrefresh.WxqContactRefreshVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信群通讯录刷新
 * @author liuqi
 * @date 2021年08月16日 15:11
 */
@Api(value = "微信群通讯录刷新",tags = "微信群|微信群通讯录刷新")
@ApiSort(31)
@RestController
public class WxqContactRefreshController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(WxqContactRefreshController.class);

    @Autowired
    private WxqContactRefreshService wxqContactRefreshService;

    @ApiOperation(value = "分页查询微信群通讯录刷新任务列表", notes = "分页查询微信群通讯录刷新任务列表", response = WxqContactRefreshVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/wxqContactRefresh/findByPage")
    public Object findWxqContactRefreshPage(@RequestBody WxqContactRefreshQuery wxqContactRefreshQuery){
        return wxqContactRefreshService.findWxqContactRefreshList(wxqContactRefreshQuery);
    }

    @ApiOperation(value = "查询微信群通讯录刷新任务详情", notes = "查询微信群通讯录刷新任务详情", response = WxqContactRefreshVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/wxqContactRefresh/findById")
    public Object findWxqContactRefresh(@RequestBody WxqContactRefreshIdDto wxqContactRefreshIdDto){
        return wxqContactRefreshService.findWxqContactRefresh(wxqContactRefreshIdDto);
    }

    @SystemLogType(model = SystemModelEnum.WxqContactRefresh, type = OperationTypeEnum.DELETE)
    @ApiOperation(value = "批量删除清理微信群通讯录刷新任务", notes = "批量删除清理微信群通讯录刷新任务")
    @ApiOperationSupport(order = 3)
    @PostMapping("/wxqContactRefresh/batchDelete")
    public Object batchDeleteWxqContactRefresh(@RequestBody WxqContactRefreshIdListDto wxqContactRefreshIdListDto){
        wxqContactRefreshService.batchDeleteWxqContactRefresh(wxqContactRefreshIdListDto);
        return true;
    }

    @ApiOperation(value = "更新微信群通讯录刷新任务", notes = "更新微信群通讯录刷新任务", response = WxqContactRefreshVo.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/wxqContactRefresh/update")
    public Object updateWxqContactRefresh(@RequestBody WxqContactRefreshIdDto wxqContactRefreshIdDto){
        wxqContactRefreshService.updateWxqContactRefresh(wxqContactRefreshIdDto);
        return true;
    }

}
